package com.shuyu.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.shuyu.common.enums.ProductType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@TableName("tbl_product")
public class Product implements Serializable {
    private static final long serialVersionUID = 5992205005680416807L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty(value = "名称")
    private String name;
    @ApiModelProperty(value = "产品类型1:NFT;2:卡牌;3:MV;4:内部权益;5:外部权益")
    private Integer type;
    private transient String typeName;

    @ApiModelProperty(value = "价格")
    private Double price;
    @ApiModelProperty(value = "活动促销价格")
    private transient Double activityPrice;
    @ApiModelProperty(value = "库存")
    private Integer stock;
    @ApiModelProperty(value = "简介")
    private String introduction;
    @ApiModelProperty(value = "图片")
    private String img;
    @ApiModelProperty(value = "审核状态0待审核 1审核完成 2 审核驳回")
    private Integer auditStatus;
    @ApiModelProperty(value = "审核备注")
    private String auditRemark;
    @ApiModelProperty(value = "状态 0上架 1下架")
    private Integer status;
    @ApiModelProperty(value = "所属专辑")
    private String album;

    //5:外部权益 权益来源 权益截止时间
    @ApiModelProperty(value = "权益来源:1:大有;2:中葡;3:敦煌文化;")
    private Integer source;
    @ApiModelProperty(value = "权益截止时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date equityEndTime;
    @ApiModelProperty(value = "第三方道具ID")
    private String propId;

    //1:NFT
    @ApiModelProperty(value = "发行公司")
    private String issuingCompany;
    @ApiModelProperty(value = "制作公司")
    private String productionCompany;
    @ApiModelProperty(value = "铸造数量")
    private Integer quantity;

    //2:卡牌
    @ApiModelProperty(value = "卡牌类型")
    private String cardType;
    @ApiModelProperty(value = "是否有NFT 0没有 1有")
    private Integer nftStatus;
    @ApiModelProperty(value = "卡牌关联NFT的产品名字")
    private transient String nftName;
    @ApiModelProperty(value = "卡牌关联NFT类型的产品ID")
    private Integer productId;
    @ApiModelProperty(value = "卡牌编号")
    private String cardSerial;
    @ApiModelProperty(value = "卡牌拥有积分")
    private Integer point;
    @JsonIgnore
    private Integer delFlag;
    @ApiModelProperty(value = "合约地址")
    private String contractAddress;

    private Date createTime;
    private Date modifyTime;
    @ApiModelProperty(value = "审核操作类型")
    private Integer operationType;

    private Integer nftCreateStatus;
    private Integer nftCreateTaskStatus;

    private transient List<NFT> nftList;

    public String getTypeName() {
        return ProductType.getTypeName(type);
    }
}
